//
//  SelectDishLeftCell.m
//  OrderSeat
//
//  Created by wangwei on 13-10-9.
//  Copyright (c) 2013年 wangwei. All rights reserved.
//

#import "SelectDishLeftCell.h"

@interface SelectDishLeftCell ()

@end

@implementation SelectDishLeftCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];
}

- (void)setContent:(NSDictionary*)dic
{
    [self.btnTitle setShowsTouchWhenHighlighted:YES];
    [self.btnTitle setTitleForNormal:[dic objectForKey:@"lbname"]];
    self.btnTitle.tag = [[dic objectForKey:@"lbid"] intValue];
    
    self.btnTitle.selected = [[dic objectForKey:@"selected"] isEqualToString:@"1"];
    
    int selectedCount = [[dic objectForKey:@"count"] intValue];
    self.btnCount.hidden = !(selectedCount > 0);
    
    if (selectedCount > 0) {
        [self.btnCount setTitleForNormal:INT_TO_STR(selectedCount)];
    }
}

- (IBAction)selectCatAction:(id)sender
{
    NSInteger catId = [sender tag];
    if (_delegate) {
        [_delegate selectSmallCatFinished:catId];
    }
}

- (IBAction)selectCateAction:(id)sender
{
    [sender setHighlighted:YES];
}


@end
